package com.example.todolist.mapper;

import com.example.todolist.entity.TaskEachDay;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface TaskEachDayMapper {
    @Update("update taskEachDay set ${weekDay} = #{status}")
    Integer updateTaskEachDay(Integer userId,String weekDay,Integer status);

    @Insert("insert into taskEachDay (userId) VALUE(#{userId})")
    void setTaskEachDay(Integer userId);

    @Select("select ${weekDay} from taskEachDay where userId=#{userId}")
    Integer getWeekStatus(Integer userId,String weekDay);

    @Select("select * from taskEachDay where userId =#{userId}")
    TaskEachDay getTaskEachDay(Integer userId);

    @Update("update taskEachDay set DAY1=0,DAY2=0,DAY3=0,DAY4=0,DAY5=0,DAY6=0,DAY7=0 where userId=#{userId}")
    void resetTaskEachDay(Integer userId);
}
